<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a {
            display: block;
            float: left;
            margin-right: 10px;
            width: 100px;
            height: 50px;
            background-color: red;
            text-decoration: none;
            /* 文字居中显示 */
            text-align: center;
            line-height: 50px;
        }

        a:hover {
            background-color: green;
        }
    </style>
</head>

<body>
    <div class="nav">
        <a href="javascript:void(0)">123</a>
        <a href="javascript:void(0)">123</a>
        <a href="javascript:void(0)">123</a>
        <a href="javascript:void(0)">123</a>
    </div>

</body>

</html>